{% extends "mainapp/base.html" %}

{% load static %}
{% load bootstrap %}

{% block title %} 批次产品信息管理 {% endblock %}

{% block content %}
    <h4 class="mb-4">修改批次产品信息</h4>
    <div class="row">
        <div class="col-6">
            <form method="post" novalidate>
                {% csrf_token %}
                <table>
                    <tr>
                        <th>生产批次号：</th>
                        <td>{{ form.h_lot_number|add_class:"form-control" }}</td>

                        <th>产品类型：</th>
                        <td>{{ form.h_product_type|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>报告编号：</th>
                        <td>{{ form.report_number|add_class:"form-control" }}</td>

                        <th>报告日期：</th>
                        <td>{{ form.report_date|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>客户名称：</th>
                        <td>{{ form.customer_name|add_class:"form-control" }}</td>

                        <th>订单号码：</th>
                        <td>{{ form.order_number|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>出货批次号：</th>
                        <td>{{ form.production_lot_number|add_class:"form-control" }}</td>

                        <th>规格型号：</th>
                        <td>{{ form.specification_model|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>批量：</th>
                        <td>{{ form.lot_quantity|add_class:"form-control" }}</td>

                        <th>方向角度：</th>
                        <td>{{ form.direction_angle|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>投料角度：</th>
                        <td>{{ form.feeding_angle|add_class:"form-control" }}</td>

                        <th>频率范围：</th>
                        <td>{{ form.frequency_range|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>频率测量间隙：</th>
                        <td>{{ form.frequency_measurement_gap|add_class:"form-control" }}</td>

                        <th>出货产品料号：</th>
                        <td>{{ form.customer_material_number|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>产品尺寸：</th>
                        <td>{{ form.product_size|add_class:"form-control" }}</td>

                        <th>外观抽样数：</th>
                        <td>{{ form.appearance_sample_quantity|add_class:"form-control" }}</td>
                    </tr>
                    <tr>
                        <th>Ma-ACC：</th>
                        <td>{{ form.ma_accept|add_class:"form-control" }}</td>

                        <th>Ma-REJ：</th>
                        <td>{{ form.ma_reject|add_class:"form-control" }}</td>
                    </tr>

                    <tr>
                        <th>△F规格值：</th>
                        <td>{{ form.frequency_diff_limit|add_class:"form-control" }}</td>

                        <th>△F管控值：</th>
                        <td>{{ form.frequency_diff_control|add_class:"form-control" }}</td>
                    </tr>

                    <tr>
                        <th>频率偏移度：</th>
                        <td>{{ form.frequency_offset_degree|add_class:"form-control" }}</td>

                        <th> </th>
                        <td> </td>
                    </tr>
                    <tr>
                        <td colspan="4" class="text-right">
                            <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                                <button type="submit" class="btn btn-primary">提交</button>
                                <a href="{% url 'product_batch_info_list' %}" class="btn btn-secondary">返回</a>
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
        <div class="col-6">
            {% if form.errors %}
                <div class="alert alert-danger mt-3">
                    <strong>提交错误:</strong>
                    <ul>
                        {% for field, errors in form.errors.items %}
                            {% for error in errors %}
                                <li>{{ field }}: {{ error }}</li>
                            {% endfor %}
                        {% endfor %}
                    </ul>
                </div>
            {% endif %}
        </div>
    </div>
{% endblock %}
